package top.chatgqt.SmartChargeStation.service.impl;

import jakarta.annotation.Resource;
import org.apache.iotdb.isession.pool.SessionDataSetWrapper;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.session.pool.SessionPool;
import top.chatgqt.SmartChargeStation.config.IotDBSessionConf;
import top.chatgqt.SmartChargeStation.service.IoTDBService;

import java.util.List;

public class IoTDBServiceImpl implements IoTDBService {

    @Resource
    private IotDBSessionConf conf;

    @Override
    public SessionDataSetWrapper executeQueryStatement(String sql) throws IoTDBConnectionException, StatementExecutionException {
        SessionPool pool = conf.initSessionPool();
        return pool.executeQueryStatement(sql);
    }

    @Override
    public SessionDataSetWrapper executeRawDataQuery(List<String> paths, long startTime, long endTime, long TimeOut) throws IoTDBConnectionException, StatementExecutionException {
        SessionPool pool = conf.initSessionPool();
        return pool.executeRawDataQuery(paths, startTime, endTime, TimeOut);
    }
}
